Learning Objectives

After completing this lesson, you’ll be able to:

Instructions

In this lesson, you will:

Resources

Editing Schema

Manipulating schema (the formal definition of a dataset’s structure) is a key process in FME. When creating an FME workspace that modifies schema, there are generally two steps:

  1. Edit the schema: define what schema you want for the written data. In FME, this is done by changing the feature type parameters to reflect what you want, e.g., changing attribute or feature type names.
  2. Map the schema: define the relationship between the source schema (what you have) and the destination schema (what you want). In FME, this is accomplished by using transformers to define how the old and new schema are related.

We’ll cover these two steps in this lesson and the next.

View Reader Feature Type Schema

You can view the schema for your reader feature types by double-clicking a reader feature type. Note, however, that the schema cannot be modified on a reader feature type. If you wish to modify your data in place, you'll have to add a writer feature type for the table or layer you'd like to modify.

Reader feature type dialog

View and Edit Writer Feature Type Schema

The writer Feature Type dialog contains all of the data’s schema information:

Viewing writer feature type schema

Scenario

Jennifer

Jennifer continues working on her workspace. This workspace creates an Esri geodatabase from JSON. Jennifer would like her geodatabase to have a different schema from her source data. She’d like to make the following changes:

Jennifer's writer feature type currently has the same schema as the source data. She now has to edit the schema to get the desired results. 

1) Open Starting Workspace

2) View Current Writer Schema

The first step is to view the current writer schema. 

Starting workspace

3) Choose an Attribute Definition Mode

We used Automatic Feature Type Definition mode when we added the geodatabase writer feature type. This mode sets the feature type's schema to match its given features.

At this point, we have two options for changing the schema of the destination data:

  1.  Continue to use Automatic mode and change the schema of the features using transformers.
  2. Change to Manual mode, manually define the destination schema, and then use transformers to set the schema on the features to match.

Option two might seem like more work, and it is! However, both approaches can be valid. Automatic mode has to infer the data type, which is (rarely) incorrect.

So, we will switch to Manual mode in the next step.

Note

In the next lesson, we'll show you how it would work with Automatic. Don't worry about Dynamic; it's an advanced option.

4) Edit Writer Feature Type Attributes

Let's change the writer feature type Attribute Definition mode to Manual.

User Attributes tab

Currently, none of the attributes can be edited because the feature type is still in Automatic Attribute Definition mode.

Changing to Manual mode

Now, the table of attributes can be edited. We can rename them, change their type, reorder them, or add a new attribute. 

The next step is to remove the attributes we do not want. 

Removing attributes

Next, reorder the attributes.

Changing attribute order

Editing attribute names

5) View Data with Edited Schema

Let's preview the data with the edited schema. 

Run button

View Written Data button

Table View with edited attributes

In the next lesson, to ensure the correct values are provided for the written data, we must map our schema, connecting the source and destination schemas.

Leave Us Feedback on This Lesson